package controlebens.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * @author Jefferson Stachelski
 */
public class Conexao {
    private Conexao(){}
    
    public static Connection getConexao() throws Exception{
        Connection conexao = null;
        Class.forName("com.mysql.jdbc.Driver");
        try{
            String banco = "controlebens";
            String servidor = "127.0.0.1";
            String usuario = "root";
            String senha = "jefferson";
            String url = "jdbc:mysql://"+servidor+"/"+banco;
            
            conexao = DriverManager.getConnection(url, usuario, senha);
        }
        catch(SQLException e){
            throw new Exception("SQL Error: "+e.getMessage());
        }
        return conexao;
    }
}
